package com.creditcmsplt.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.creditcmsplt.mapper.CreditApiMapper;
import com.creditcmsplt.service.CreditApiService;
import com.creditcmsplt.util.TextUtils;

@Service
public class CreditApiServiceImpl implements CreditApiService{

	@Autowired
	private CreditApiMapper creditApiMapper;

	@Transactional
	@Override
	public void insert(String token, String vendor_key, String vendor_secret, Integer status, String apiurl) {
		if(!TextUtils.isEmpty(token)) {
			creditApiMapper.insertByToken(token, apiurl, status);
		}else {
			creditApiMapper.insertByKey(vendor_key, vendor_secret, apiurl, status);
		}
	}
}
